package com.lk.sys.controller;

import com.lk.sys.common.vo.JsonResult;
import com.lk.sys.common.vo.PageObject;
import com.lk.sys.entity.SysLog;
import com.lk.sys.service.SysLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/log/")
public class SysLogController {

    @Autowired
    private SysLogService sysLogService;

    //http://localhost/log/findPageObjects?pageCurrent=1
    @RequestMapping("findPageObjects")
    @ResponseBody
    public JsonResult findPageObjects(String username, Long pageCurrent) {
        PageObject<SysLog> pageObjects = sysLogService.findPageObjects(username, pageCurrent);
        return new JsonResult(pageObjects);
    }

    //http://localhost/log/deleteObjects?id=4,5,6
    @ResponseBody
    @RequestMapping("deleteObjects")
    public JsonResult deleteObjects(int... ids) {
        sysLogService.deleteObjects(ids);
        return new JsonResult("delete OK");
    }

}
